package com.sh.data.engine.domain.datadev.offline.model.domain;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.Date;
import java.util.List;

/**
 * @author：jingchen.hr
 * @descripion:
 * @data:11/2/2021 10:27 AM
 */
@Data
//@ApiModel
public class OfflineDevOperationTaskflowDetailInfoDomain {

    // 基本信息
//    @ApiModelProperty("任务名称")
    private String name;

    //    @ApiModelProperty("任务类型 0-周期执行 1-手动执行")
    private Integer executeType;

    //    @ApiModelProperty("调度周期 0-日 1-周 2-月 3-季 4-年")
    private Integer cycle;

    //    @ApiModelProperty("是否跨周期依赖")
    private Boolean isDependent;

    //    @ApiModelProperty("创建时间")
    private Date createTime;

    //    @ApiModelProperty("责任人")
    private String userName;

    // 运行信息
//  @ApiModelProperty("运行状态 1-运行中 2-成功 3-失败 4-停止 5-暂停")
//  private Integer status;
//
//  @ApiModelProperty("计划执行时间")
//  private Date planTime;
//
//  @ApiModelProperty("开始时间")
//  private Date startTime;
//
//  @ApiModelProperty("结束时间")
//  private Date endTime;
//
//  @ApiModelProperty("运行时长")
//  private BigDecimal executeTime;

    /**
     * 是否发送过告警 0-否 1-是
     */
    private Integer isSendAlarm;

    private Integer isAttention;

    /**
     * 更新时间
     */
    private Date updateTime;

    private Integer cycleDependency;

//  private List<ExpendInfo> expendInfos;

    private List<TaskFlowSubTask> nodes;

    private List<TaskFlowSubTaskDependency> edges;

    @Data
    public static class TaskFlowSubTaskDependency {
        private String upNodeId;

        private String downNodeId;

        /**
         * 0-执行成功后执行 1-执行失败后执行 2-执行失败成功都执行
         */
        private Integer status;

        private Integer rowState;
    }

    @Data
    public static class TaskFlowSubTask {
        private Long nodeId;

        private String nodeName;

        private Integer rowState;

        private String coordX;

        private Integer nodeType;

        private String coordY;
    }

    @Data
//    @ApiModel
    public static class Edge {
        //    @ApiModelProperty(value = "依赖关系的id")
        private String id;

        //    @ApiModelProperty(value = "任务id")
        private String from;

        //    @ApiModelProperty(value = "任务id")
        private String to;

        //    @ApiModelProperty(value = "0-执行成功后执行   1-执行失败后执行 2-执行失败成功都执行")
        private Integer status;
    }

    @Data
//    @ApiModel
    @AllArgsConstructor
    @NoArgsConstructor
    public static class ExpendInfo {
        //    @ApiModelProperty("节点id")
        private Long id;

        //    @ApiModelProperty("节点任务名称")
        private String nodeName;

        //    @ApiModelProperty("执行状态 3-成功 其他均判断为失败")
        private Integer status;

        //    @ApiModelProperty("开始时间")
        private Date startTime;

        //    @ApiModelProperty("nodeId")
        private Long nodeId;

        //    @ApiModelProperty("结束时间")
        private Date endTime;
    }
}
